package org.infohome.android.FlyingDroid;

import android.view.ViewGroup;

public class OutputController extends AccessoryController {

	private boolean mVertical;

	OutputController(FlyingDroidActivity hostActivity, boolean vertical) {
		super(hostActivity);
		mVertical = vertical;
	}

	protected void onAccesssoryAttached() {
		setupServoController(1, R.id.servo1);
		setupServoController(2, R.id.servo2);
		setupServoController(3, R.id.servo3);
		setupServoController(4, R.id.servo4);
		setupServoController(5, R.id.servo5);
		
		//setupServoController(3, R.id.servo3);

//		setupLedController(1, R.id.leds1);
//		setupLedController(2, R.id.leds2);
//		setupLedController(3, R.id.leds3);
//
//		setupRelayController(1, R.id.relay1);
//		setupRelayController(2, R.id.relay2);
	}

	private void setupServoController(int servoIndex, int viewId) {
		ServoController sc = new ServoController(mHostActivity, servoIndex);
		sc.attachToView((ViewGroup) findViewById(viewId));
	}
	
	private void setupSensorController(int servoIndex, int viewId) {
		SensorController sc = new SensorController(mHostActivity, servoIndex);
		sc.attachToView((ViewGroup) findViewById(viewId));
		//sc.onPositionChange(0.1);
	}

//	private void setupLedController(int index, int viewId) {
//		ColorLEDController ledC = new ColorLEDController(mHostActivity, index,
//				getResources(), mVertical);
//		ledC.attachToView((ViewGroup) findViewById(viewId));
//	}
//
//	private void setupRelayController(int index, int viewId) {
//		RelayController r = new RelayController(mHostActivity, index,
//				getResources());
//		r.attachToView((ViewGroup) findViewById(viewId));
//	}

}
